//
// Created by WangYu on 2017/11/24.
//

#ifndef LEARN_C_GET_FUNCTION_H
#define LEARN_C_GET_FUNCTION_H

#include <mem.h>
#include "examples.h"

typedef int (*funcP)();

funcP getFuncPointer(char *sfuncname) {
    if (strcmp(sfuncname, "example1") == 0) {
        return &example1;
    } else if (strcmp(sfuncname, "example2") == 0) {
        return &example2;
    } else if (strcmp(sfuncname, "example3") == 0) {
        return &example3;
    } else if (strcmp(sfuncname, "example4") == 0) {
        return &example4;
    } else if (strcmp(sfuncname, "example5") == 0) {
        return &example5;
    } else if (strcmp(sfuncname, "example6") == 0) {
        return &example6;
    } else if (strcmp(sfuncname, "example7") == 0) {
        return &example7;
    } else if (strcmp(sfuncname, "example8") == 0) {
        return &example8;
    } else if (strcmp(sfuncname, "example9") == 0) {
        return &example9;
    } else if (strcmp(sfuncname, "example10") == 0) {
        return &example10;
    } else if (strcmp(sfuncname, "example11") == 0) {
        return &example11;
    } else if (strcmp(sfuncname, "example12") == 0) {
        return &example12;
    } else if (strcmp(sfuncname, "example13") == 0) {
        return &example13;
    } else if (strcmp(sfuncname, "example14") == 0) {
        return &example14;
    } else if (strcmp(sfuncname, "example15") == 0) {
        return &example15;
    } else if (strcmp(sfuncname, "example16") == 0) {
        return &example16;
    } else if (strcmp(sfuncname, "example17") == 0) {
        return &example17;
    } else if (strcmp(sfuncname, "example18") == 0) {
        return &example18;
    } else if (strcmp(sfuncname, "example19") == 0) {
        return &example19;
    } else if (strcmp(sfuncname, "example20") == 0) {
        return &example20;
    } else if (strcmp(sfuncname, "example21") == 0) {
        return &example21;
    } else if (strcmp(sfuncname, "example22") == 0) {
        return &example22;
    } else if (strcmp(sfuncname, "example23") == 0) {
        return &example23;
    } else if (strcmp(sfuncname, "example24") == 0) {
        return &example24;
    } else if (strcmp(sfuncname, "example25") == 0) {
        return &example25;
    } else if (strcmp(sfuncname, "example26") == 0) {
        return &example26;
    } else if (strcmp(sfuncname, "example27") == 0) {
        return &example27;
    } else if (strcmp(sfuncname, "example28") == 0) {
        return &example28;
    } else if (strcmp(sfuncname, "example29") == 0) {
        return &example29;
    } else if (strcmp(sfuncname, "example30") == 0) {
        return &example30;
    } else if (strcmp(sfuncname, "example31") == 0) {
        return &example31;
    } else if (strcmp(sfuncname, "example32") == 0) {
        return &example32;
    } else if (strcmp(sfuncname, "example33") == 0) {
        return &example33;
    } else if (strcmp(sfuncname, "example34") == 0) {
        return &example34;
    } else if (strcmp(sfuncname, "example35") == 0) {
        return &example35;
    } else if (strcmp(sfuncname, "example36") == 0) {
        return &example36;
    } else if (strcmp(sfuncname, "example37") == 0) {
        return &example37;
    } else if (strcmp(sfuncname, "example38") == 0) {
        return &example38;
    } else if (strcmp(sfuncname, "example39") == 0) {
        return &example39;
    } else if (strcmp(sfuncname, "example40") == 0) {
        return &example40;
    } else if (strcmp(sfuncname, "example41") == 0) {
        return &example41;
    } else if (strcmp(sfuncname, "example42") == 0) {
        return &example42;
    } else if (strcmp(sfuncname, "example43") == 0) {
        return &example43;
    } else if (strcmp(sfuncname, "example44") == 0) {
        return &example44;
    } else if (strcmp(sfuncname, "example45") == 0) {
        return &example45;
    } else if (strcmp(sfuncname, "example46") == 0) {
        return &example46;
    } else if (strcmp(sfuncname, "example47") == 0) {
        return &example47;
    } else if (strcmp(sfuncname, "example48") == 0) {
        return &example48;
    } else if (strcmp(sfuncname, "example49") == 0) {
        return &example49;
    } else if (strcmp(sfuncname, "example50") == 0) {
        return &example50;
    } else if (strcmp(sfuncname, "example51") == 0) {
        return &example51;
    } else if (strcmp(sfuncname, "example52") == 0) {
        return &example52;
    } else if (strcmp(sfuncname, "example53") == 0) {
        return &example53;
    } else if (strcmp(sfuncname, "example54") == 0) {
        return &example54;
    } else if (strcmp(sfuncname, "example55") == 0) {
        return &example55;
    } else if (strcmp(sfuncname, "example56") == 0) {
        return &example56;
    } else if (strcmp(sfuncname, "example57") == 0) {
        return &example57;
    } else if (strcmp(sfuncname, "example58") == 0) {
        return &example58;
    } else {
        printf("None!");
    }
}

#endif //LEARN_C_GET_FUNCTION_H
